# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DFAReporting.V33.Model.ReportSchedule do
  @moduledoc """
  The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY".

  ## Attributes

  *   `active` (*type:* `boolean()`, *default:* `nil`) - Whether the schedule is active or not. Must be set to either true or false.
  *   `every` (*type:* `integer()`, *default:* `nil`) - Defines every how many days, weeks or months the report should be run. Needs to be set when "repeats" is either "DAILY", "WEEKLY" or "MONTHLY".
  *   `expirationDate` (*type:* `Date.t`, *default:* `nil`) - 
  *   `repeats` (*type:* `String.t`, *default:* `nil`) - The interval for which the report is repeated. Note: - "DAILY" also requires field "every" to be set. - "WEEKLY" also requires fields "every" and "repeatsOnWeekDays" to be set. - "MONTHLY" also requires fields "every" and "runsOnDayOfMonth" to be set. 
  *   `repeatsOnWeekDays` (*type:* `list(String.t)`, *default:* `nil`) - List of week days "WEEKLY" on which scheduled reports should run.
  *   `runsOnDayOfMonth` (*type:* `String.t`, *default:* `nil`) - Enum to define for "MONTHLY" scheduled reports whether reports should be repeated on the same day of the month as "startDate" or the same day of the week of the month. Example: If 'startDate' is Monday, April 2nd 2012 (2012-04-02), "DAY_OF_MONTH" would run subsequent reports on the 2nd of every Month, and "WEEK_OF_MONTH" would run subsequent reports on the first Monday of the month.
  *   `startDate` (*type:* `Date.t`, *default:* `nil`) - 
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :active => boolean() | nil,
          :every => integer() | nil,
          :expirationDate => Date.t() | nil,
          :repeats => String.t() | nil,
          :repeatsOnWeekDays => list(String.t()) | nil,
          :runsOnDayOfMonth => String.t() | nil,
          :startDate => Date.t() | nil
        }

  field(:active)
  field(:every)
  field(:expirationDate, as: Date)
  field(:repeats)
  field(:repeatsOnWeekDays, type: :list)
  field(:runsOnDayOfMonth)
  field(:startDate, as: Date)
end

defimpl Poison.Decoder, for: GoogleApi.DFAReporting.V33.Model.ReportSchedule do
  def decode(value, options) do
    GoogleApi.DFAReporting.V33.Model.ReportSchedule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DFAReporting.V33.Model.ReportSchedule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
